import 'package:flutter/material.dart';
import 'package:flutter_09_game/base/widget/base_get_builder.dart';
import 'package:flutter_09_game/config/app_color.dart';
import 'package:flutter_09_game/generated/assets.dart';
import 'package:flutter_09_game/generated/locales.g.dart';
import 'package:flutter_09_game/user/app_user_manager.dart';
import 'package:flutter_09_game/utils/log/utils_log.dart';
import 'package:flutter_09_game/widgets/appbar/common_app_bar.dart';
import 'package:flutter_09_game/widgets/image/auto_image.dart';
import 'package:flutter_09_game/widgets/tab/common_tab_bar_page.dart';
import 'package:flutter_09_game/widgets/tab/custom_tab_indicator.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import 'home_gameplay_tutorial_logic.dart';

class HomeGameplayTutorialPage extends StatelessWidget {
  HomeGameplayTutorialPage({super.key});

  final HomeGameplayTutorialLogic logic = Get.put(HomeGameplayTutorialLogic());

  @override
  Widget build(BuildContext context) {
    return BaseGetBuilder<HomeGameplayTutorialLogic>(
      appBar: CommonAppBar(
        title: LocaleKeys.gameplayTutorial.tr,
        actions: [
          GestureDetector(
            onTap: () {
              AppUserManager().showServiceSheet();
            },
            child: AutoImage(
              Assets.commonServiceBtn,
              width: 32.w,
            ),
          ),
          10.horizontalSpace,
        ],
      ),
      backgroundColor: AppColor.pageBgColor,
      builder: (_) {
        // clog('daskdhkj1');
        // if (logic.tabController == null) {
        //   return const SizedBox();
        // }

        return CommonTabBarPage(
            // tabIsScrollable: false,
            // tabBarPadding: EdgeInsets.symmetric(horizontal: 24.w),
            labelPadding: EdgeInsets.symmetric(horizontal: 12.w),
            tabController: logic.tabController,
            indicatorSize: TabBarIndicatorSize.tab,
            // fitTabBackgroundColor: Colors.red,
            indicator: CustomTabIndicator(
              width: 80.w,
              height: 2.w,
              indicatorPadding: EdgeInsets.only(top: 0.w),
              color: AppColor.primary,
              // borderRadius: 2.w,
              isCentered: true,
            ),
            tabData: logic.tabData);
      },
    );
  }
}
